 var nav = document.querySelector('nav');
    window.onscroll = function () {
        var scrollTop = document.body.scrollTop || document.scrollingElement.scrollTop;
        if (scrollTop >= 130) {
            nav.style.position = 'fixed';
            nav.style.top = '0';
             if (nav.style.top != 0) {
             setTimeout(function(){      
                nav.style.top = '0px';
            },100);
         }
        } else {
            nav.style.position = 'static';
            nav.style.top = -2*nav.offsetHeight + 'px';
        }

    }
// -------------------------------------------------------------
    var lunbo = document.querySelector('.lunbo');
    var lunboList = document.querySelector('.lunbo-list');
    var img = document.querySelectorAll('.lunbo-list li');
    var indicatorLis = document.querySelectorAll('.lunbo-bottom li');
    var prev = document.querySelector('.prev');
    var next = document.querySelector('.next');
    var hua = document.querySelector('.hua');

    var index = 0;
    function prevImg() {
        index = index == 0 ? index = img.length - 1 : index - 1;
        showImg();
    }

    function nextImg() {
        index = index == img.length - 1 ? 0 : index + 1;
        showImg();
    }

    function showImg() {
        for (var i = 0; i < img.length; i++) {
            img[i].className = '';
            indicatorLis[i].className = '';
        }
        img[index].className = 'current';
        indicatorLis[index].className = 'active';
        var left = indicatorLis[index].offsetLeft;
        hua.style.left = left + 'px';
    }
    var timer = setInterval(nextImg, 1000);

    for (var i = 0; i < indicatorLis.length; i++) {
        indicatorLis[i].index = i;
        indicatorLis[i].onmouseover = function () {
            clearInterval(timer);
            timer = null;

            index = this.index;

            showImg();
        }
        indicatorLis[i].onmouseout = function () {
            // 鼠标出去，开始切换
            if (timer != null) {
                return;
            }
            timer = setInterval(nextImg, 1000);
        }
    }

    lunbo.onmouseover = function () {
        clearInterval(timer);
        timer = null;
        // prev.style.visibility = 'visible';
        // next.style.visibility = 'visible';
        // prev.style.left = '379px';
        // next.style.right = '379px';
    }
    lunbo.onmouseout = function () {
        if (timer) return;
        timer = setInterval(nextImg, 1000);
        // prev.style.visibility = 'hidden';
        // next.style.visibility = 'hidden';
        // prev.style.left = '309px';
        // next.style.right = '309px';
    }

    prev.onclick = function () {
        prevImg();
    }
    next.onclick = function () {
        nextImg();
    }

    // ----------------------------------------------------
    var info1 = document.querySelector('.info-1');
    var info1Left = document.querySelector('.info-1-left');
    var close = document.querySelector('.close');
    var aside = document.querySelector('aside');

    info1.onmouseover = function () {
        info1Left.style.right = '35px';
        info1.style.backgroundColor = '#df147f';
    }
    info1.onmouseout = function () {
        info1Left.style.right = '-250px';
        info1.style.backgroundColor = '';
    }
    close.onclick = function () {
        info1Left.style.right = '-250px';

    }

    var info8 = document.querySelector('.info-8');
    info8.onclick = function () {
        document.documentElement.scrollTop = document.body.scrollTop = 0;
    }
